package com.sanbi.erp.db.config;

import com.sanbi.erp.core.system.ErrorEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

/**
 * @Desc: 错误信息处理服务工具包
 * @Data: 2022/8/19 9:03
 * @Author: jxk
 */
@EqualsAndHashCode(callSuper = true)
@Data
@NoArgsConstructor
@AllArgsConstructor
public class BizException extends RuntimeException{

    private ErrorEnum.ErrorCode errorCode;
    private Integer code;
    private String msg;

    public BizException(ErrorEnum.ErrorCode errorCode){
        super();
        this.code = errorCode.getCode();
        this.msg = errorCode.getMessage();
    }

    public BizException(Integer code, String msg){
       this.code=code;
       this.msg=msg;
    }
}
